//index.js
//获取应用实例
var app = getApp()
var order = ['demo1', 'demo2', 'demo3']
//设置页面信息
Page({
  data: {
    toView: 'green'
  },
  upper: function (e) {
    console.log(e)
  },
  lower: function (e) {
    console.log(e)
  },
  scroll: function (e) {
    console.log(e)
  },
  scrollToTop: function (e) {
    this.setAction({
      scrollTop: 0
    })
  },
  tap: function (e) {
    for (var i = 0; i < order.length; ++i) {
      if (order[i] === this.data.toView) {
        this.setData({
          toView: order[i + 1],
          scrollTop: (i + 1) * 200
        })
        break
      }
    }
  },
  tapMove: function (e) {
    this.setData({
      scrollTop: this.data.scrollTop + 10
    })
  },
 
  onLoad: function () {
    console.log('onLoad')
    var that = this
    //调用应用实例的方法获取全局数据
    app.getUserInfo(function(userInfo){
      //更新数据
      that.setData({
        userInfo:userInfo
      })
    })

//取当前地理位置
  

    //从服务端获取数据
   /* wx.request({
          url: 'https://www.lizhenqing.me/get_json',
          method: 'GET',
          header: {'content-type': 'application/json'}, 
          success:function(res) 
          {
              console.log(res.data);
              that.setData({
                serverResp: res.data
              })
          },
          fail:function(res){  
              console.log('submit fail');  
          }
      })
   */


  }
})
